package com.kmxd.ams.core.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import java.util.Arrays;
import java.util.Objects;

/**
 * 档案利用操作
 *
 * @author nickbi
 */
public enum I18nTypeEnum {

  /** 提示消息 */
  PROMPT_MESSAGE(1, "提示消息"),
  SYSTEM_INTERFACE(2, "系统界面"),
  DICTIONARY_DATA(3, "字典数据"),
  ARCHIVE_METADATA(4, "档案元数据"),
  ;

  @EnumValue private final Integer type;
  private final String desc;

  @JsonValue
  public Integer getType() {
    return type;
  }

  public String getDesc() {
    return desc;
  }

  I18nTypeEnum(Integer type, String desc) {
    this.type = type;
    this.desc = desc;
  }

  @JsonCreator
  public static I18nTypeEnum getValue(Integer type) {
    return Arrays.stream(values()).filter(x -> Objects.equals(x.type, type)).findAny().orElse(null);
  }
}
